﻿package mortal.game.view.systemSetting
{
    import com.gengine.utils.*;
    import com.mui.serialization.json.*;
    import flash.utils.*;
    import mortal.game.view.common.*;

    public class ClientSettingInfo extends Object
    {
        private var _mapInfo:Dictionary;
        public var isDirty:Boolean = false;
        public var isDoneList:Array;
        public var valueTest:Number = 0.5;
        public var drugPackSetting:Object;
        public var AFAssistSkillValues:Array;
        public var AFWizardSkillId:int = 0;
        public var autoGuides:Array;
        public var AutoFightQualityIndex:int = 0;
        public var AutoFightCareerIndex:int = 0;
        public var guideXPSkillUseTimes:int = 0;
        public var guideVipTime:int = 0;
        public var enterCrossNormalDate:int = 0;

        public function ClientSettingInfo()
        {
            this._mapInfo = new Dictionary();
            this.isDoneList = [];
            this.drugPackSetting = {2:85, 3:85, 13:85};
            this.AFAssistSkillValues = [];
            this.autoGuides = [];
            this.initMapInfo();
            return;
        }// end function

        private function initMapInfo() : void
        {
            this._mapInfo["isDoneList"] = "a";
            this._mapInfo["valueTest"] = "b";
            this._mapInfo["AFAssistSkillValues"] = "c";
            this._mapInfo["drugPackSetting"] = "d";
            this._mapInfo["autoGuides"] = "e";
            this._mapInfo["AutoFightQualityIndex"] = "f";
            this._mapInfo["AutoFightCareerIndex"] = "g";
            this._mapInfo["guideXPSkillUseTimes"] = "h";
            this._mapInfo["guideVipTime"] = "i";
            this._mapInfo["AFWizardSkillId"] = "j";
            this._mapInfo["enterCrossNormalDate"] = "k";
            return;
        }// end function

        public function getString() : String
        {
            var _loc_4:* = undefined;
            var _loc_1:* = ObjectParser.getClassVars(this);
            var _loc_2:* = ClientSetting.defualt;
            var _loc_3:* = new Object();
            for each (_loc_4 in _loc_1)
            {
                
                if (this[_loc_4] is Array)
                {
                    _loc_3[this._mapInfo[_loc_4]] = [];
                    ClassTypesUtil.copyValue(_loc_3[this._mapInfo[_loc_4]], this[_loc_4]);
                    continue;
                }
                if (this[_loc_4] != _loc_2[_loc_4])
                {
                    _loc_3[this._mapInfo[_loc_4]] = this[_loc_4];
                }
            }
            return JSON.serialize(_loc_3);
        }// end function

        public function toObject() : Object
        {
            var _loc_3:* = undefined;
            var _loc_1:* = new Object();
            var _loc_2:* = ObjectParser.getClassVars(this);
            for each (_loc_3 in _loc_2)
            {
                
                if (this[_loc_3] is Array)
                {
                    _loc_1[_loc_3] = [];
                    ClassTypesUtil.copyValue(_loc_1[_loc_3], this[_loc_3]);
                    continue;
                }
                _loc_1[_loc_3] = this[_loc_3];
            }
            return _loc_1;
        }// end function

        public function initFromServerStr(param1:String) : Object
        {
            var _loc_4:* = undefined;
            if (param1 == "" || param1 == null)
            {
                return null;
            }
            var _loc_2:* = JSON.deserialize(param1);
            var _loc_3:* = ObjectParser.getClassVars(this);
            for each (_loc_4 in _loc_3)
            {
                
                if (_loc_2.hasOwnProperty(this._mapInfo[_loc_4]))
                {
                    if (_loc_2[this._mapInfo[_loc_4]] is Array)
                    {
                        this[_loc_4] = [];
                        ClassTypesUtil.copyValue(this[_loc_4], _loc_2[this._mapInfo[_loc_4]]);
                        continue;
                    }
                    this[_loc_4] = _loc_2[this._mapInfo[_loc_4]];
                }
            }
            return _loc_2;
        }// end function

        public function copy(param1:ClientSettingInfo) : void
        {
            var _loc_4:* = undefined;
            var _loc_2:* = ObjectParser.getClassVars(this);
            var _loc_3:Array = [];
            for each (_loc_4 in _loc_2)
            {
                
                if (param1[_loc_4] is Array)
                {
                    this[_loc_4] = [];
                    ClassTypesUtil.copyValue(this[_loc_4], param1[_loc_4]);
                    continue;
                }
                this[_loc_4] = param1[_loc_4];
            }
            return;
        }// end function

        public function setIsDone(param1:Boolean, param2:uint = 0) : void
        {
            var _loc_3:* = int(param2 / 31);
            if (this.isDoneList.length <= _loc_3)
            {
                this.isDoneList[_loc_3] = 0;
            }
            var _loc_4:* = this.isDoneList[_loc_3];
            var _loc_5:* = param2 - 31 * _loc_3;
            var _loc_6:* = param1 ? (1) : (0);
            this.isDoneList[_loc_3] = ClassTypesUtil.getSetBitValueResult(_loc_4, _loc_5, _loc_6);
            this.isDirty = true;
            return;
        }// end function

        public function getIsDone(param1:uint = 0) : Boolean
        {
            var _loc_2:* = int(param1 / 31);
            if (this.isDoneList.length <= _loc_2)
            {
                return false;
            }
            var _loc_3:* = param1 - 31 * _loc_2;
            var _loc_4:* = this.isDoneList[_loc_2];
            var _loc_5:* = ClassTypesUtil.getBitValue(_loc_4, _loc_3);
            return _loc_5 == 1 ? (true) : (false);
        }// end function

        public function setDrugPack(param1:int, param2:int) : void
        {
            this.drugPackSetting[param2] = param1;
            this.isDirty = true;
            return;
        }// end function

    }
}
